import { configureStore } from '@reduxjs/toolkit'
import storage from 'redux-persist/lib/storage'
import { persistReducer } from 'redux-persist'
import { combineReducers } from '@reduxjs/toolkit'
import userReducer from './modules/userStore'

const reducers = combineReducers({
  user: userReducer
})

const persistConfig = {
  key: 'root',
  storage
  // whitelist: ['user']
  // blacklist: ['user']
}

const persistedReducer = persistReducer(persistConfig, reducers)

export default configureStore({
  reducer: persistedReducer,
  middleware: getDefaultMiddleware =>
    getDefaultMiddleware({
      serializableCheck: false
    })
  // devTools: process.env.NODE_ENV !== 'production'
})
